package com.example.demo.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.demo.entry.UserAccount;
import com.example.demo.service.UserAccountService;
import com.example.demo.mapper.UserAccountMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 16040
* @description 针对表【user_account】的数据库操作Service实现
* @createDate 2022-04-22 14:24:41
*/
@Service
public class UserAccountServiceImpl extends ServiceImpl<UserAccountMapper, UserAccount>
implements UserAccountService{

    @Autowired
    private UserAccountMapper userAccountMapper;


    @Override
    public List<UserAccount> Login(String account, String password) {
        return userAccountMapper.selectByAccountAndPassword(account,password);
    }

    @Override
    public Boolean Register(String account, String password,String name, String sex) {
        return userAccountMapper.register(account,password,name,sex);
    }

    @Override
    public Boolean checkAccountExist(String account) {
        List<UserAccount>  list = userAccountMapper.checkAccountExist(account);
        Boolean checked = null;
        if(list.size()>0){
            checked = false;
        }else {
            checked = true;
        }
        return checked;
    }

    @Override
    public Boolean modifyInfo(String name,String sex,int age,String phone,String address,String account) {
        return userAccountMapper.modifyInfo(name,sex,age,phone,address,account);
    }

}
